<script type="text/javascript">
    window.UEDITOR_HOME_URL = "__PUBLIC__/Lib/ueditor/";
</script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Lib/ueditor/editor_all.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Lib/ueditor/editor_config.js"></script>
<div class="rounded table" style="width: 98%;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="box_top">
        <thead class="thead">
            <tr class="space">
                <th colspan="10">添加管理员</th>
            </tr>
        </thead>
    </table>
    <form action="{:U('Admin/System/doSaveAdmin')}" method="post" id="doEditAdmin" class="formvalidate">
        <table class="list" cellpadding="0" cellspacing="1" border="0">
            <tbody>
                <tr class="even">
                    <td class="name">
                        <label class="validation"><span class="spanMsg">*</span>用户名:</label>
                    </td>
                    <td>
                        <input name="u_name" type="text" class="input rounded" value="" size="30" maxlength="50" required validate="{ required:true,maxlength:30,remote:'{:U('Admin/System/checkName')}'}" /> 
                    </td>
                    <td class="field">
                        <img title="这里输入管理员登陆时需要的账号" class="title2div" src="__PUBLIC__/Admin/images/icons/icon_help.png" width="16" height="16" style="line-height: 16px;">
                    </td>
                </tr>
                <tr class="even">
                    <td class="name" width="150">
                        <label class="validation">
                            <span class="spanMsg">*</span>密码：
                        </label>

                    </td>
                    <td>
                        <input id="u_password" name="u_password" type="password" class="input rounded" value="" size="30" maxlength="50" validate="{ required:true,rangelength:[6,20],equalTo:'#u_password'}" /> 
                    </td>
                    <td class="field">
                        <img title="6 - 20个字符组成，只能使用数字、字母和下划线" class="title2div" src="__PUBLIC__/Admin/images/icons/icon_help.png" width="16" height="16" style="line-height: 16px;">
                    </td>
                </tr>
                <tr class="odd">
                    <td class="name">
                        <label class="validation">
                            <span class="spanMsg">*</span>确认密码：
                        </label>
                    </td>
                    <td>
                        <input type="password" class="input rounded" name="confirm_password" size="50" value="" style="width:192px;" validate="{ required:true,rangelength:[6,20],equalTo:'#u_password'}">

                    </td>
                    <td class="field">
                        <img title="6 - 20个字符组成，只能使用数字、字母和下划线" class="title2div" src="__PUBLIC__/Admin/images/icons/icon_help.png" width="16" height="16">
                    </td>
                </tr>
                <tr class="even">
                    <td class="name" width="150">
                        <label class="validation">
                            姓名：
                        </label>
                    </td>
                    <td>
                        <input name="u_username" type="text" class="input rounded" value="{$data.u_username}" size="30" maxlength="50" validate="{ username:true}" /> 
                    </td>
                    <td class="field">
                        <img title="5 - 50个字符组成，只能使用数字、字母和下划线" class="title2div" src="__PUBLIC__/Admin/images/icons/icon_help.png" width="16" height="16">
                    </td>
                </tr>
                <tr class="even">
                    <td class="name" width="150">
                        <label class="validation">
                            <span class="spanMsg">*</span>性别：
                        </label>
                    </td>  
                    <td class="rowform">
                        <ul>

                            <li>
                                <label>
                                    <input type="radio" checked="checked" value="1" name="u_sex">男</label>
                            </li>
                            <li>
                                <label>
                                    <input type="radio" value="2" name="u_sex">女</label>
                            </li>
                            <li>
                                <label>
                                    <input type="radio"  value="0" name="u_sex">保密</label>
                            </li>
                        </ul>
                    </td>
                    <td class="field">

                    </td>
                </tr>
                <tr class="odd">
                    <td class="name">
                        <label class="validation">
                            <span class="spanMsg">*</span>所属组：
                        </label>
                    </td> 
                    <td>
                        <select name="role_id" class="select rounded" style="font-family:'Courier New',Courier,monospace;">
                            <volist name="role" id="re">
                                <option value="{$re.id}">{$re.name}</option>
                            </volist>
                        </select> 

                    </td>
                    <td class="field"></td>
                </tr>

                <tr class="even">
                    <td class="name"  width="150">
                        <label class="validation">
                            手机：
                        </label>
                    </td> 
                    <td><input name="u_phone" id="u_phone" type="text" class="input rounded" value="" size="30" maxlength="50" /> </td>
                    <td class="field"></td>
                </tr>
                <tr>
                    <td class="name">
                        <label class="validation">
                            邮箱：
                        </label>
                    </td> 
                    <td>
                        <input name="u_email" type="text" class="input rounded" value="" size="30" maxlength="50" validate="{ email:true}" /> 
                    </td>
                    <td class="field"></td>
                </tr>
                <tr class="even">
                    <td class="name">
                        <label class="validation">
                            头像：
                        </label>
                    </td> 
                    <td>
                        <input name="u_photo" type="text" class="input rounded photo" value="" id="photo"   size="30" style="float: left;"/> 
                        <a href="javascript:upImage('photo');" id="button1" value="" class="type-file-button"></a>
                    </td>
                    <td class="field">

                    </td>
                </tr>
                <tr class="even">
                    <td class="name">
                        <label class="validation">
                            QQ：
                        </label>
                    </td> 
                    <td>
                        <input name="u_qq" type="text" class="input rounded" value="" size="30" /> 
                    </td>
                    <td class="field">

                    </td>
                </tr>
                <tr class="odd">
                    <td class="name" width="150">
                        <label class="validation">
                            <span class="spanMsg">*</span>状态：
                        </label>
                    </td> 
                    <td class="rowform">
                        <ul>

                            <li>
                                <label>
                                    <input type="radio" checked="checked" value="1" name="u_status">启用</label>
                            </li>
                            <li>
                                <label>
                                    <input type="radio" value="0" name="u_status">停用</label>
                            </li>
                        </ul>
                    </td>
                    <td class="field">

                    </td>
                </tr>
                <tr class="even">
                    <td class="name">
                        <label class="validation">
                            描述：
                        </label>
                    </td>
                    <td>
                        <textarea class="text-input textarea" id="wysiwyg" name="u_description" rows="10" cols="75"></textarea>
                    </td>
                    <td class="field"></td>
                </tr>
            </tbody>
        </table>
        <table class="table top_line">
            <tbody>
                <tr>
                    <td align="center" height="60" colspan="2">
                        <input id="submit" class="btn" type="submit" value="提交">
                            <input type="reset" id="reset" class="btn reset" value="重置">
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</div>

<script>
    //显示一个新对话框
    function showWin(){
        artDialog({
            content:'欢迎使用 "artDialog" 对话框组件！', 
            fixed:true, 
            lock:false,
            style:'succeed'
        }, function(){
            artDialog({
                title:' ', 
                content:'谢谢观赏', 
                lock:true, 
                time:2
            })
        });
    };    
    //Ueditor上传 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    var dom;
    var editor = new UE.ui.Editor({
        imageRealPath:"images"
    });
    editor.render("myEditor");
    var dialog_img;
    editor.ready(function(){
        editor.hide();
        dialog_img = editor.getDialog("insertimage");
        editor.addListener('beforeInsertImage',function(t, arg){
            $("#"+dom).val(arg[0]['src']);
        });
        editor.addListener('afterUpfile',function(t, arg){
            $("#"+dom).val(arg[0]['url']);
        });
    });
    function upImage(pid) {
        dom = pid;
        dialog_img.open();
    }
</script>